<?php declare(strict_types=1);


namespace PinWuYun\command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Created: by zhiJie
 * Date: 2021/7/3
 */
class TestCmd extends Command
{
    private $msg;
    public function __construct($msg)
    {
        $this->msg = $msg;
        parent::__construct();
    }

    protected function configure()
    {
        $this->setName('test');
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $a = ['name'=>'kervi', 'age' => 18];
        $this->decode($a);
        var_dump($a);
        $output->writeln("<comment>".$this->msg."</comment>");
        return 0;
    }

    public function decode(&$p)
    {
        // 多维数组，内部引用
        $b = &$p['name'];
        $age = $p['age'];
        $b = 'ddd';
        $age = 10;

    }
}